import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:honeypotflutter/modules/account/page/account_transfer_balance/view.dart';
import 'package:honeypotflutter/modules/account/page/account_withdraw_history/view.dart';
import 'package:honeypotflutter/public/public_get.dart';
import 'package:honeypotflutter/publicBussine/bussine_colors.dart';
import 'package:honeypotflutter/publicBussine/bussine_image.dart';
import 'package:honeypotflutter/publicBussine/loginInfo/bussine_userInfo.dart';
import 'package:honeypotflutter/publicBussine/view/bussine_card.dart';
import 'package:honeypotflutter/publicBussine/view/bussine_item.dart';
import 'package:honeypotflutter/publicBussine/view/bussine_switchMonry.dart';
import 'package:honeypotflutter/public/views/public_appBar.dart';
import 'package:honeypotflutter/public/views/public_scrollView.dart';
import 'logic.dart';

class AccountIncomePage extends StatefulWidget {
  const AccountIncomePage({Key? key}) : super(key: key);

  @override
  State<AccountIncomePage> createState() => _AccountIncomePageState();
}

class _AccountIncomePageState extends State<AccountIncomePage> {
  final AccountIncomeLogic logic = Get.put(AccountIncomeLogic());

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: HLAppBar(navigationTitle: "我的收入"),
      body: HLScrollView(
        padding: EdgeInsets.all(16),
        children: [
          MGCard(
            backColor: MGColors.themeColor.withOpacity(0.7),
            padding: EdgeInsets.only(top: 30, bottom: 30),
            children: [
              GetBuilder<UserInfoLogic>(
                  init: UserInfoLogic(),
                  builder: (controller) {
                    return MGSwitchMonry(
                      title: "收入余额(元)",
                      showExchange: false,
                      color: MGColors.text1Color,
                      crossAxisAlignment: CrossAxisAlignment.center,
                      monry: controller.userInfo.wallet,
                    );
                  }),
            ],
          ),
          SizedBox(height: 20),
          MGCard(
            children: [
              MGItems(
                leadTitle: "签约",
                trailingIcon: MGImage.image("public_next"),
                showBottomSplit: true,
                action: logic.pushToSign,
              ),
              MGItems(
                leadTitle: "提现",
                trailingIcon: MGImage.image("public_next"),
                showBottomSplit: true,
                action: logic.pushToWithDrawAmount,
              ),
              MGItems(
                leadTitle: "转到余额",
                trailingIcon: MGImage.image("public_next"),
                showBottomSplit: true,
                action: () {
                  HLGet.to(AccountTransferBalancePage());
                },
              ),
              MGItems(
                leadTitle: "提现记录",
                trailingIcon: MGImage.image("public_next"),
                action: () {
                  HLGet.to(AccountWithdrawHistoryPage());
                },
              )
            ],
          ),
        ],
      ),
    );
  }

  @override
  void dispose() {
    Get.delete<AccountIncomeLogic>();
    super.dispose();
  }
}
